import request from '@/utils/request.js'

// 上传文件
export const uploadFile = (formData) => {
  return request.post('/upload', formData, {
    headers: {
      'Content-Type': 'multipart/form-data'
    }
  })
}

// 判断token是否过期
export const checkToken = (token) => {
  return request.get('/checkToken', {
    params: {
      token
    }
  })
}

// 写评论
export const writeReviews = (data) => {
  return request.post('/writeReviews', data)
}

// 获取评论列表
export const getReviewsList = ({ type, typeId, page, pageSize }) => {
  return request.get('/getReviews', {
    params: {
      type,
      typeId,
      page,
      pageSize
    }
  })
}

// 用户评分
export const userRating = (data) => {
  return request.post('/rate', data)
}

// 获取评分信息
export const getRate = ({ type, typeId, userId }) => {
  return request.get('/getRate', {
    params: {
      type,
      typeId,
      userId
    }
  })
}

// 获取用户看过或想看的状态
export const getWantOrSeeStatus = ({ type, typeId, userId }) => {
  return request.get('/getWantOrSeeStatus', {
    params: {
      type,
      typeId,
      userId
    }
  })
}

// 获取用户想看或看过的数据
export const getWantOrSeeList = ({
  page,
  pageSize,
  wantStatus,
  seeStatus,
  userId
}) => {
  return request.get('/getWantOrSeeList', {
    params: {
      page,
      pageSize,
      wantStatus,
      seeStatus,
      userId
    }
  })
}

// 修改想看或看过的状态
export const changeWantOrSeeStatus = (data) => {
  return request.post('/wantOrSee', data)
}
